package com.zz.cc.owner;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.zz.common.app.BaseActivity;

public class TitleBaseActivity extends BaseActivity {
	
	private TextView mTitle;
	private FrameLayout mContent;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		super.setContentView(R.layout.layout_common_title_activity);
		initUI();
	}
	
	@Override
	public void setContentView(int layoutId) {
		View v = LayoutInflater.from(this).inflate(layoutId, null);
		mContent.addView(v);
	}
	
	@Override
	public void setContentView(View layout) {
		mContent.addView(layout);
	}
	
	protected String getCurrentTitle() {
		return mTitle.getText().toString();
	}
	
	protected void setCurrentTitle(int rId) {
		setCurrentTitle(getString(rId));
	}
	
	protected void setCurrentTitle(String title) {
		mTitle.setText(title);
	}
	
	@Override
	protected String onGetTitleMirror() {
		return getCurrentTitle();
	}
	
	@Override
	public void onBackPressed() {
//		super.onBackPressed();
		finish();
		overridePendingTransition(R.anim.activity_slide_right_in, R.anim.activity_slide_left_out);
	}
	
	private void initUI() {
		mTitle = (TextView) findViewById(R.id.common_title);
		mContent = (FrameLayout) findViewById(R.id.common_content);
	}
}
